$(function() {
    forselect();
});

function getChart(space) {
    if (space > 1) {
        energy_statistic.xAxis = getMonth(space);
        var data = energy_statistic.xAxis;
        energy_statistic.series[0].data = getRandom900h1200h2(data.length);
        energy_statistic.series[1].data = getRandom900h1200h2(data.length);
    } else {
        energy_statistic.xAxis = getDate(space);
        var data = energy_statistic.xAxis;
        energy_statistic.series[0].data = getRandom30h40h2(data.length);
        energy_statistic.series[1].data = getRandom30h40h2(data.length);
    }
    stackbar('container', energy_statistic.title, energy_statistic.subtitle,
        energy_statistic.xAxis, energy_statistic.yAxis, energy_statistic.series, energy_statistic.unit);
}

function forselect() {
    var space = getSpace();
    getChart(space);
}